package com.aaa.fpa.service;


import com.aaa.fpa.dao.PlanDao;
import com.aaa.pojo.Page;
import com.aaa.pojo.Plan;
import com.aaa.pojo.ResultBean;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PlanServiceimpl implements PlanService{
    @Autowired
    private PlanDao planDao;
    @Override
    public ResultBean findAllpn(Page page,Plan plan) {

        PageHelper.startPage(page.getPage(), page.getLimit());

        //查数据

        List<Plan> list = planDao.findAllpn(plan);

        /* System.out.println("data"+list);*/

        PageInfo<Plan> pageInfo=new PageInfo<Plan>(list);

        return new ResultBean(0,"查询成功",pageInfo.getTotal(),pageInfo.getList());

    }
    @Override
    public  int updatepn(Plan plan){

        return  planDao.updatepn(plan);
    }
    @Override
    public  int deletepn( int id){

        return planDao.deletepn(id);
    }
    @Override
    public  int savepn(Plan plan){

        return planDao.savepn(plan);
    }
    @Override
    public  int deletespn(@Param("id") int[] id){
        return  planDao.deletespn(id);
    }
}
